<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>摇色子</title>
	</head>
	<style type="text/css">
		*{
			margin: 0;
			padding:0;
		}
		 #div_head{
			 margin-top: 100px;
			 width: 400px;
			 height:200px;
			 border: 3px dashed  #000000;
			 border-radius: 20px;
			 background-color: white ;
			 
		 }
		 img{
			 margin-left: 175px;
			 margin-top: 10px;
			 width: 50px;
		 }
		 select,input{
			 width: 100px;
			 height: 30px;
			 margin-left: 150px;
			 margin-top: 30px;
			 font-size: 15px;
			 font-family: 宋体;
			 font-weight: bold;		  
		 }
	</style>
	<body>
		<div id="div_head">
		<img src="img/work2/1.jpg" id="img1">
		<hr >
		<select id="maxin">
			<option>请下注</option>
			<option value="123">大</option>
			<option value ="456">小</option>
		</select>
		<input type="button" value="开始" onclick="star(event)"/>
		</div>
	</body>
	<script type="text/javascript">
		var num=0;
		var img1=document.getElementById('img1');
		var opti=document.getElementById('maxin')
		
		
		
		
		function star(event){
			event.target.value = "在来一次";
			var rand1=0;
			
			var setTime=setInterval(function(){
				num=num+1;
				rand1=rom();
				img1.src='./img/work2/'+rand1+'.jpg';
				if(num>=10){
					switch (opti.value){
						
						case '123':
							if(rand1>=4&&rand1<=6){
								alert('您押了大！，赢了');
								break;
							}else{
								alert('您押了大，开！是小，您赔钱了');
								break;
							}
						case '456':
							if(rand1>=1 && rand1<=3){
								alert('您押小！，赢了');
								break;
							}else{
								alert('您押了小，开！是大，您赔钱了');
								break;
							}
						default:
							alert('您没下注呢！草');
							clearInterval(setTime);
							break;
					}
					clearInterval(setTime);
					num=0;
				}
				
			

			},50);
			
		
			
		}
		function rom(){
			var rand= Math.ceil(Math.random()*1000000000%6);
			return rand;
		}
	</script>
	
</html>
